﻿using System;
using System.Collections.Generic;
using System.Text;

namespace T.FAS.Runtime.Base.Entity
{
    /// <summary>
    /// 数据变更项
    /// </summary>
    public class TChangeSetItem
    {
        /// <summary>
        /// 变更项字段业务类型
        /// </summary>
        public BusinessType BusinessType { get; set; }
        public DataType DataType { get; set; } = DataType.String;
        public string ColumnCode { get;set; }
        public string ColumnName { get; set; }
        /// <summary>
        /// 初始值,用于数据变更日志生成
        /// </summary>
        public object InitValue { get; set; }
        /// <summary>
        /// 初始显示值,用于数据变更日志生成
        /// </summary>
        public object InitDisplayName { get; set; }
        /// <summary>
        /// 旧值
        /// </summary>
        public object OldValue { get; set; }
        /// <summary>
        /// 旧值显示内容
        /// </summary>
        public string OldDisplayValue { get; set; }
        /// <summary>
        /// 新值
        /// </summary>
        public object NewValue { get; set; }
        /// <summary>
        /// 新值显示内容
        /// </summary>
        public string NewDisplayValue { get; set; }
        /// <summary>
        /// 顺序号
        /// </summary>
        public int SortOrder { get; set; }

        public Dictionary<string, object> ExtParam { get; set; }
        public TChangeSetItem Clone()
        {
            return new TChangeSetItem()
            {
                BusinessType= this.BusinessType,
                ColumnCode = this.ColumnCode,
                ColumnName = this.ColumnName,
                InitValue = this.InitValue,
                InitDisplayName = this.InitDisplayName,
                OldValue = this.OldValue,
                OldDisplayValue = this.OldDisplayValue,
                NewValue = this.NewValue,
                NewDisplayValue = this.NewDisplayValue,
                SortOrder = this.SortOrder,
            };
        }
    }
    public enum BusinessType
    {
        Normal,
        PK,
        State,
        SDO
    }
}
